package com.zshan.clinic.web.controller.config;


import com.zshan.clinic.admin.entity.vo.DictAcupointTreeVo;
import com.zshan.clinic.admin.entity.vo.DictAcupointVo;
import com.zshan.clinic.admin.entity.vo.DictRegionTreeVo;
import com.zshan.clinic.admin.service.config.ClinicDictService;
import com.zshan.clinic.common.response.RestResp;
import com.zshan.clinic.web.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 枚举常量
 */
@RestController
@RequestMapping("/config/dict")
public class ClinicDictController extends AbstractController {


    @Autowired
    private ClinicDictService clinicDictService;

    /**
     * 获取区域列表
     * @return
     */
    @GetMapping("/getRegionTreeList")
    public RestResp<List<DictRegionTreeVo>> getRegionTreeList(){
        List<DictRegionTreeVo> regionTreeList = clinicDictService.getRegionTreeList();
        return RestResp.SUCCESS(regionTreeList);
    }

    /**
     * 获取穴位树列表
     * @return
     */
    @GetMapping("/getAcupointTreeList")
    public RestResp<List<DictAcupointTreeVo>> getAcupointTreeList(@RequestParam(name = "acupointText", required = false) String acupointText){
        List<DictAcupointTreeVo> acupointTreeList = clinicDictService.getAcupointTreeList(acupointText);
        return RestResp.SUCCESS(acupointTreeList);
    }


    /**
     * 门诊：根据穴位名查询穴位列表
     * @param acupointText 穴位名
     * @return
     */
    @GetMapping("/getAcupointListByText")
    public RestResp<List<DictAcupointVo>> getAcupointListByText(@RequestParam(name = "acupointText",required = false) String acupointText){
        List<DictAcupointVo> dictAcupointVoList = clinicDictService.getAcupointListByText(acupointText);
        return RestResp.SUCCESS(dictAcupointVoList);
    }

}
